package com.zhilianbao.leyaogo.ui.fragment.me.mes;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.bql.recyclerview.swipe.SwipeMenuAdapter;
import com.bql.recyclerview.swipe.SwipeMenuCreator;
import com.zhilianbao.leyaogo.R;
import com.zhilianbao.leyaogo.ui.adapter.me.MesAdapter;
import com.zhilianbao.leyaogo.ui.fragment.base.SwipeRefreshAndLoadFragment;
import com.zhilianbao.leyaogo.view.decoration.ListLineDecoration;

/**
 * Created by liu on 2016/10/26.
 * 消息
 */
public class MessageFragment extends SwipeRefreshAndLoadFragment {
    MesAdapter mMesAdapter;
    public static MessageFragment getInstance() {
        MessageFragment fragment = new MessageFragment();
        return fragment;
    }
    @Override
    public void onRcvItemClick(RecyclerView.ViewHolder holder, int position) {
       if (position == 0) {
           start(SysMesFragment.getInstance());
       }else if (position == 1) {
           start(CouponMesFragment.getInstance());
       }
    }

    @Override
    public SwipeMenuAdapter getAdapter() {
        return mMesAdapter;
    }

    @Override
    public RecyclerView.ItemDecoration getItemDecoration() {
        return new ListLineDecoration();
    }

    @Override
    public RecyclerView.LayoutManager getLayoutManager() {
        return new LinearLayoutManager(mActivity);
    }

    @Override
    public SwipeMenuCreator getSwipeMenuCreator() {
        return null;
    }

    @Override
    public void onLeftSwipeMenuClick(int adapterPosition, int menuPosition) {

    }

    @Override
    public void onRightSwipeMenuClick(int adapterPosition, int menuPosition) {

    }

    @Override
    public void onRefresh() {
        loadDataList(1, true);
    }

    @Override
    public void loadDataList(int curPage, boolean isPullToRefresh) {
        mCurPage = curPage;
    }

    @Override
    public void onLoadMore() {
        loadDataList(mCurPage, true);
    }

    @Override
    protected void initToolbarHere() {
        initToolbar(getString(R.string.message));
    }

    @Override
    protected void initViewsAndEvents(Bundle savedInstanceState) {
        mMesAdapter = new MesAdapter(mActivity,mList);
    }

}